<?php
/*************************************************************************

$Id: xtc304sp2.config.php 543 2010-07-15 12:47:10Z dis $

iclear payment system - because secure is simply secure
http://www.iclear.de

Copyright (c) 2001 - 2009 iclear

Released under the GNU General Public License

************************************************************************

All rights reserved.

This program is free software licensed under the GNU General Public License (GPL).

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA

*************************************************************************/

if(!defined('IC_SEC')) {
	die('No external calls allowed!');
}

global $icCore;

if(!defined('DIR_WS_CATALOG')) {
	$icSysPath = $icCore->getPath();
	require $icSysPath . 'includes/configure.php';

	define('PROJECT_VERSION', 'xt:Commerce v3.0.4 SP2');
	$request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

	if (version_compare(PHP_VERSION, '5.0.0', '>'))
	if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
	else
	if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];

	// include the list of project filenames
	require (DIR_WS_INCLUDES.'filenames.php');

	// include the list of project database tables
	require (DIR_WS_INCLUDES.'database_tables.php');

	// SQL caching dir
	define('SQL_CACHEDIR', DIR_FS_CATALOG.'cache/');

	// Database
	require_once (DIR_FS_INC.'xtc_db_connect.inc.php');
	require_once (DIR_FS_INC.'xtc_db_close.inc.php');
	require_once (DIR_FS_INC.'xtc_db_error.inc.php');
	require_once (DIR_FS_INC.'xtc_db_perform.inc.php');
	require_once (DIR_FS_INC.'xtc_db_query.inc.php');
	require_once (DIR_FS_INC.'xtc_db_queryCached.inc.php');
	require_once (DIR_FS_INC.'xtc_db_fetch_array.inc.php');
	require_once (DIR_FS_INC.'xtc_db_num_rows.inc.php');
	require_once (DIR_FS_INC.'xtc_db_data_seek.inc.php');
	require_once (DIR_FS_INC.'xtc_db_insert_id.inc.php');
	require_once (DIR_FS_INC.'xtc_db_free_result.inc.php');
	require_once (DIR_FS_INC.'xtc_db_fetch_fields.inc.php');
	require_once (DIR_FS_INC.'xtc_db_output.inc.php');
	require_once (DIR_FS_INC.'xtc_db_input.inc.php');
	require_once (DIR_FS_INC.'xtc_db_prepare_input.inc.php');
	require_once (DIR_FS_INC.'xtc_get_top_level_domain.inc.php');

	//20100817 CA added check for some Gambio Versions
	if (file_exists(DIR_FS_CATALOG . 'gm/classes/GMTSWidget.php')) {
		require_once (DIR_FS_CATALOG . 'gm/classes/GMTSWidget.php');
		require_once (DIR_FS_INC.'xtc_cleanName.inc.php');
	}
	
	//20110201 CA added new require xtc_get_all_get_params
	require_once (DIR_FS_INC . 'xtc_get_all_get_params.inc.php');

	// make a connection to the database... now
	xtc_db_connect() or die('Unable to connect to database server!');

	$configuration_query = xtc_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from '.TABLE_CONFIGURATION);
	while ($configuration = xtc_db_fetch_array($configuration_query)) {
		define($configuration['cfgKey'], $configuration['cfgValue']);
	}

	// extra stuff 2 load 4 subsequent classes
	require_once (DIR_FS_INC.'xtc_not_null.inc.php');
	require_once (DIR_WS_CLASSES.'shopping_cart.php');
	require_once DIR_FS_INC . 'xtc_calculate_tax.inc.php';
	require_once DIR_FS_INC . 'xtc_add_tax.inc.php';
	require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
	require_once DIR_FS_INC . 'xtc_href_link.inc.php';
	require_once DIR_FS_INC . 'xtc_php_mail.inc.php';
	require_once DIR_FS_INC . 'xtc_redirect.inc.php';
	require_once DIR_FS_INC . 'xtc_round.inc.php';
	// DB iclear patch 090624 - intercept missing function xtc_image used by sofort�berweisung
	require_once DIR_FS_INC . 'xtc_image.inc.php';

	require_once DIR_WS_FUNCTIONS . 'sessions.php';
	require_once (DIR_WS_CLASSES.'xtcPrice.php');

	//20100818 CA added support for newer smarty version (used by commerce:SEO for example)
	if (file_exists(DIR_WS_CLASSES.'Smarty_2.6.14/Smarty.class.php'))
	require_once (DIR_WS_CLASSES.'Smarty_2.6.14/Smarty.class.php');
	else if (file_exists(DIR_WS_CLASSES.'Smarty_2.6.26/Smarty.class.php'))
	require_once (DIR_WS_CLASSES.'Smarty_2.6.26/Smarty.class.php');
	
	//20110309 CA added fix for ot_coupon
	if (file_exists(DIR_FS_INC.'xtc_get_tax_rate_from_desc.inc.php'))
		require_once (DIR_FS_INC.'xtc_get_tax_rate_from_desc.inc.php');

	require_once (DIR_WS_CLASSES.'class.phpmailer.php');
	if (EMAIL_TRANSPORT == 'smtp')
	require_once (DIR_WS_CLASSES.'class.smtp.php');
	
	//20111019 CA added object product
	if (file_exists(DIR_WS_CLASSES.'product.php'))
		require_once (DIR_WS_CLASSES.'product.php');

	// set the application parameters - taken from application_top.php#174++

	function xtDBquery($query) {
		if (DB_CACHE == 'true') {
			//      echo  'cached query: '.$query.'<br>';
			$result = xtc_db_queryCached($query);
		} else {
			//        echo '::'.$query .'<br>';
			$result = xtc_db_query($query);

		}
		return $result;
	}

	// Gambio GX patches
	$icPath = DIR_FS_CATALOG . 'gm/classes/GMLangFileMaster.php';
	if(file_exists($icPath)) {
		require_once $icPath;
		require_once (DIR_FS_CATALOG . 'gm/classes/GMAltText.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMTracker.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMMeta.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMCat.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMLogoManager.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMEbay.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMCounter.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMStatusbar.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMTabTokenizer.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMSEOBoost.php');
		require_once (DIR_FS_CATALOG . 'gm/classes/GMLightboxControl.php');
		require_once (DIR_FS_CATALOG . 'admin/gm/classes/GMOpenSearch.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_clear_string.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_prepare_string.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_set_conf.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_get_conf.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_set_content.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_get_content.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_get_content_by_group_id.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_get_categories_icon.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_mega_flyover_prepare.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_is_valid_trusted_shop_id.inc.php');
		require_once (DIR_FS_CATALOG . 'gm/inc/gm_convert_qty.inc.php');

		global $gmLangFileMaster;
		$gmLangFileMaster = new GMLangFileMaster();
	}


	function CacheCheck() {
		if (USE_CACHE == 'false') return false;
		if (!isset($_COOKIE['XTCsid'])) return false;
		return true;
	}

	require (DIR_WS_CLASSES.'main.php');
	global $main;
	$main = new main();



}

$lang =& $icCore->getLanguage();
// define XT:C admin backoffice labels
define('IC_LABEL', 'MODULE_PAYMENT_ICLEAR_');

foreach( array('STATUS', 'ID', 'ZONE', 'SORT_ORDER', 'ORDER_STATUS_ID', 'ALLOWED') AS $key) {
	define(IC_LABEL . $key . '_TITLE', $lang->getParam($key . '_TITLE'));
	define(IC_LABEL . $key . '_DESC', $lang->getParam($key . '_DESC'));
}
define(IC_LABEL . 'TEXT_TITLE', $lang->getParam('MODULE_TITLE'));

define('IC_SESSION_NAME', 'XTCsid');
// load wrapper
require_once dirname(__FILE__) . '/' . basename(preg_replace('/.' . $icCore->cloneID() . '/', '', __FILE__), '.config.php') . '.php';

?>
